import logging,pytest,HTMLTestRunner_cn
import time

import yagmail


class Tools():
    def Log(self):
        logging.basicConfig(filename='jx.log', filemode='a+', level=logging.DEBUG,
                            format='%(filename)s %(levelname)s %(asctime)s %(message)s %(lineno)d')





    def BaoGao(self):
        baogao = HTMLTestRunner_cn.HTMLTestRunner(open('jx.html','wb'),title='w+',description='酒仙网登录测试报告')

        return baogao


    def email(self):
        t = time.strftime('%Y_%m_%d_%H_%M_%S',
                          time.localtime())

        email = yagmail.SMTP(user='3484055372@qq.com',
                             password='Ngqyabdsctyocigf',host='smtp.qq.com')
        email.send(to='3484055372@qq.com',
                   subject='酒仙网自动化测试报告',
                   contents='jx.log,jx.html')

        return email



if __name__ == '__main__':
    Tools().Log()
    pytest.main([r'E:\gaowu_2303A\GuoQing10_1\zy2\TestCase.py','-s',
                 '--html=jx.html'])
    Tools().email()


